home *** CD-ROM | disk | FTP | other *** search
Wrap
<AM5TASK> <AMTASKHEAD> <TASKINFO TASKNAME=""> <\AMTASKHEAD> <STEPS> <!--- Show message box telling the user what is going on ---> <AMMESSAGEBOX WINDOWTITLE="Sample Task" BUTTONS="ok_cancel" ICON="information" ONSECONDBUTTONCLICK="stop">This sample task demonstrates the following: 1) Use of the Input Action to ask the user a question and retrieve the answer 2) Use of Custom BASIC Functions 3) Use of the IF action 4) Use of Expressions Remember you can always stop a task in progress by pressing CTRL-ALT-END. Press okay to continue running the task or Cancel to stop now.</AMMESSAGEBOX> <!--- Create variable to store answer from input box. ---> <AMVARIABLE NAME="theanswer" DESCRIPTION=""></AMVARIABLE> <!--- This custom function takes a number, squares it, and returns the result. ---> <AMSCRIPT>Function SquareNumber(thenum) SquareNumber = thenum * thenum End Function</AMSCRIPT> <!--- Input box will ask what number user would like to square. ---> <AMINPUTBOX RESULTVARIABLE="theanswer">What number would you like to square?</AMINPUTBOX> <!--- Make sure that the value entered is a valid number. ---> <AMIF EXPRESSION="IsNumeric(theanswer) = true"> <!--- Display result of answer send to our custom function. ---> <AMMESSAGEBOX>The number %theanswer% squared is: %SquareNumber(theanswer)%</AMMESSAGEBOX> <AMELSE> <!--- Tell the user an invalid entry was entered. ---> <AMMESSAGEBOX>The text "%theanswer%" is not a valid number. Please re-run and enter a valid number.</AMMESSAGEBOX> </AMIF> <\STEPS> </AM5TASK>